package com.tj.collection.controller.lending.response;

import com.fqgj.common.api.ResponseData;
import com.fqgj.common.utils.StringUtils;
import com.tj.collection.db.entity.ClCallDurationEntity;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: pavan
 * Date: 2020/3/23
 * Time: 下午8:33
 */
public class ClCallDurationResponse implements ResponseData {

    private List<Item> callDurationList;

    public ClCallDurationResponse(List<ClCallDurationEntity> clCallDurationEntityList) {
        this.callDurationList = new ArrayList<>();
        for (ClCallDurationEntity entity : clCallDurationEntityList) {
            Item item = new Item();
            BeanUtils.copyProperties(entity, item);
            item.setId(entity.getId() + "");
            if (StringUtils.isNotEmpty(entity.getVideoUrl2())) {
                item.setVideoUrl(entity.getVideoUrl2());
            }
            if (item.getVideoUrl() != null && item.getVideoUrl().endsWith(".amr")) {
                item.setVideoUrl("");
            }
            this.callDurationList.add(item);
        }
    }

    private class Item {
        private String id;
        /**
         * 分单号
         */
        private String allocationNo;
        /**
         * 催收单号
         */
        private String collectionNo;
        /**
         * 跟进人
         */
        private Integer followId;
        /**
         * 跟进人
         */
        private String followUp;
        /**
         * 被呼叫的号码
         */
        private String mobile;
        /**
         * 起始时间
         */
        private String startTime;
        /**
         * 结束时间
         */
        private String endTime;
        /**
         * 通话时长 秒
         */
        private Integer callDuration;
        /**
         * 录音文件链接
         */
        private String videoUrl;

        public String getId() {
            return id;
        }

        public Item setId(String id) {
            this.id = id;
            return this;
        }

        public String getAllocationNo() {
            return allocationNo;
        }

        public Item setAllocationNo(String allocationNo) {
            this.allocationNo = allocationNo;
            return this;
        }

        public String getCollectionNo() {
            return collectionNo;
        }

        public Item setCollectionNo(String collectionNo) {
            this.collectionNo = collectionNo;
            return this;
        }

        public Integer getFollowId() {
            return followId;
        }

        public Item setFollowId(Integer followId) {
            this.followId = followId;
            return this;
        }

        public String getFollowUp() {
            return followUp;
        }

        public Item setFollowUp(String followUp) {
            this.followUp = followUp;
            return this;
        }

        public String getMobile() {
            return mobile;
        }

        public Item setMobile(String mobile) {
            this.mobile = mobile;
            return this;
        }

        public String getStartTime() {
            return startTime;
        }

        public Item setStartTime(String startTime) {
            this.startTime = startTime;
            return this;
        }

        public String getEndTime() {
            return endTime;
        }

        public Item setEndTime(String endTime) {
            this.endTime = endTime;
            return this;
        }

        public Integer getCallDuration() {
            return callDuration;
        }

        public Item setCallDuration(Integer callDuration) {
            this.callDuration = callDuration;
            return this;
        }

        public String getVideoUrl() {
            return videoUrl;
        }

        public Item setVideoUrl(String videoUrl) {
            this.videoUrl = videoUrl;
            return this;
        }
    }

}
